<?php
// +----------------------------------------------------------------------
// | @filename CreatePermissionGroupRequest.php
// +----------------------------------------------------------------------
// | @author 落花轻舞问君愁 <mwcx1990@qq.com>
// +----------------------------------------------------------------------
// | @datetime 2021-11-01 13:33:31
// +----------------------------------------------------------------------
// | @Description
// +----------------------------------------------------------------------

namespace Addons\Backend\Http\Requests\Permission;


use Addons\Backend\Http\Requests\BaseRequest;

class CreatePermissionGroupRequest extends BaseRequest
{
    public function rules(): array
    {
        return [
            'name' => ['bail', 'required', 'min:2', 'max:40'],
            'pid' => ['bail', 'required', 'integer'],
        ];
    }

    public function messages(): array
    {
        return [
            'name.required' => '请输入权限规则',
            'name.min' => '权限组名称不能少于2位',
            'name.max' => '权限组名称不能大于255位',
            'pid.required' => '请选择父级权限组',
            'pid.integer' => '父级权限组必须是个id',
        ];
    }

    public function authorize(): bool
    {
        return true;
    }
}
